package com.weight.system.sensor.service.impl;

import com.weight.system.sensor.PO.SensorInfo;
import com.weight.system.sensor.service.SensorInfoService;
import com.weight.system.sensor.DAO.SensorInfoMapper;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import org.springframework.transaction.annotation.Transactional;
import com.weight.common.util.CommonUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * 传感器错误标记表
 */
@Service
@Transactional
@Slf4j
public class SensorInfoServiceImpl implements SensorInfoService {

	@Autowired
	private SensorInfoMapper sensorInfoMapper;


	/**
	 * 查询传感器错误标记信息--条件查询
	 * @param map
	 * @return
	 */
	@Override
	public List<SensorInfo> findSensorInfoByT(Map map){
		return sensorInfoMapper.findSensorInfoByT(map);
	}

	/**
	 * 查询传感器错误标记信息--条件，分页查询
	 * @param currentPage
	 * @param pageSize
	 * @param map
	 * @return
	 */
	@Override
	public List<SensorInfo> findSensorInfoByPage(int currentPage,int pageSize,Map map){
		PageHelper.startPage(currentPage, pageSize);
		List<SensorInfo> sensorInfoList = sensorInfoMapper.findSensorInfoByT(map);
		return sensorInfoList;
	}

	/**
	 * 查询传感器错误标记信息--查询全部
	 * @return
	 */
	@Override
	public List<SensorInfo> findAll(){
		return sensorInfoMapper.findAll();
	}

	/**
	 * ID查询传感器错误标记信息
	 * @param map
	 * @return
	 */
	@Override
	public SensorInfo findBySensorInfoId(Map map){
		SensorInfo sensorInfo=sensorInfoMapper.findBySensorInfoId(map);
		CommonUtils.validateExistObj(sensorInfo,map);
		return sensorInfo;
	}

	/**
	 * ID查询传感器错误标记信息-批量
	 * @param sensorInfoIdList
	 * @return
	 */
	@Override
	public List findBySensorInfoIdList(List sensorInfoIdList){
		List idList = sensorInfoMapper.findBySensorInfoIdList(sensorInfoIdList);
		CommonUtils.validateExistList(idList,sensorInfoIdList);
		return idList;
	}

	/**
	 * 添加传感器错误标记
	 * @param sensorInfo
	 */
	@Override
	public void insertSensorInfo(SensorInfo sensorInfo){
		sensorInfoMapper.insertSensorInfo(sensorInfo);
	}

	/**
	 * 批量添加传感器错误标记
	 * @param sensorInfoList
	 */
	@Override
	public void insertSensorInfoBatch(List<SensorInfo> sensorInfoList){
		sensorInfoMapper.insertSensorInfoBatch(sensorInfoList);
	}

	/**
	 * 修改传感器错误标记
	 * @param sensorInfo
	 */
	@Override
	public void updateSensorInfo(SensorInfo sensorInfo){
		sensorInfoMapper.updateSensorInfo(sensorInfo);
	}

	/**
	 * 修改传感器错误标记
	 * @param sensorInfo
	 */
	@Override
	public void updateSensorInfoLimt(SensorInfo sensorInfo){
		sensorInfoMapper.updateSensorInfoLimt(sensorInfo);
	}

	/**
	 * 物理删除传感器错误标记
	 * @param map
	 */
	@Override
	public void deleteBySensorInfoId(Map map){
		sensorInfoMapper.deleteBySensorInfoId(map);
	}

	/**
	 * 批量物理删除传感器错误标记
	 * @param sensorInfoIdList
	 */
	@Override
	public void deleteBySensorInfoIdBatch(List sensorInfoIdList){
		sensorInfoMapper.deleteBySensorInfoIdBatch(sensorInfoIdList);
	}

	/**
	 * 状态删除传感器错误标记
	 * @param map
	 */
	@Override
	public void upDelBySensorInfoId(Map map){
		sensorInfoMapper.upDelBySensorInfoId(map);
	}

	/**
	 * 批量状态删除传感器错误标记
	 * @param sensorInfoList
	 */
	@Override
	public void upDelBySensorInfoIdBatch(Map<String, Object> map){
		sensorInfoMapper.upDelBySensorInfoIdBatch(map);
	}

}